* progmodes/sh-script.el (sh-mode): Use define-derived-mode.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 13 May 2010 00:44:22 +0000 (20:44 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 13 May 2010 00:44:22 +0000 (20:44 -0400)
lisp/ChangeLog
lisp/progmodes/sh-script.el

index 1b1073ba0d34c2a302b34594e0b796a7b1468d57..25cf7238bffc2669e612d09f0f7908fb635ffe2d 100644 (file)
@@ -1,5 +1,7 @@
 2010-05-13  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * progmodes/sh-script.el (sh-mode): Use define-derived-mode.
+
        * dos-fns.el: Add "dos-" prefix for namespace control.
        (convert-standard-filename): Define as alias for
        dos-convert-standard-filename but only if applicable.
index 610fa14489ab17191bea3569582da806894a6496..eca6d5fbe7b7bed53410cddb29e802f06005069c 100644 (file)
@@ -1480,7 +1480,7 @@ frequently editing existing scripts with different styles.")
 ;; mode-command and utility functions
 
 ;;;###autoload
-(defun sh-mode ()
+(define-derived-mode sh-mode prog-mode "Shell-script"
   "Major mode for editing shell scripts.
 This mode works for many shells, since they all have roughly the same syntax,
 as far as commands, arguments, variables, pipes, comments etc. are concerned.
@@ -1533,11 +1533,6 @@ indicate what shell it is use `sh-alias-alist' to translate.
 
 If your shell gives error messages with line numbers, you can use \\[executable-interpret]
 with your script for an edit-interpret-debug cycle."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'sh-mode
-       mode-name "Shell-script")
-  (use-local-map sh-mode-map)
   (make-local-variable 'skeleton-end-hook)
   (make-local-variable 'paragraph-start)
   (make-local-variable 'paragraph-separate)
@@ -1613,8 +1608,7 @@ with your script for an edit-interpret-debug cycle."
           "sh")
          (t
           sh-shell-file))
-   nil nil)
-  (run-mode-hooks 'sh-mode-hook))
+   nil nil))
 
 ;;;###autoload
 (defalias 'shell-script-mode 'sh-mode)